Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[beam] add toast notification component #177

Merged
merged 6 commits into from
Nov 7, 2024

Conversation

crabinak
Copy link
Collaborator

@agritheory I added the toast notifications using vue-toast-notifications. I was able to override styling in the beam style sheet to align the colors with the Beam-defined ones. There are some controls on Histoire that will let you change a few settings in case you want to see it in a different position.

Let me know if this will work.

@crabinak crabinak requested a review from agritheory October 28, 2024 18:10
Copy link
Contributor

github-actions bot commented Oct 28, 2024

Coverage Report for ./beam

Status Category Percentage Covered / Total
🔴 Lines 5.88% (🎯 70%) 7 / 119
🔴 Statements 6.4% (🎯 70%) 8 / 125
🔴 Functions 2.77% (🎯 70%) 1 / 36
🔴 Branches 0% (🎯 70%) 0 / 68
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
beam/src/components/BeamFilter.vue 0% 0% 0% 0% 18-9
beam/src/components/BeamFilterOption.vue 0% 0% 0% 0% 41-21
beam/src/components/ItemCheck.vue 0% 0% 0% 0% 9-3
Unchanged Files
beam/src/components/ActionFooter.vue 0% 100% 0% 0% 12-3
beam/src/components/BeamArrow.vue 0% 0% 100% 0% 2-4
beam/src/components/BeamMetadata.vue 0% 0% 0% 0% 2-1
beam/src/components/BeamModal.vue 0% 0% 0% 0% 3-5
beam/src/components/BeamModalOutlet.vue 0% 100% 100% 0% 2
beam/src/components/BeamProgress.vue 0% 0% 0% 0% 22-3
beam/src/components/Confirm.vue 0% 0% 0% 0% 4-5
beam/src/components/ItemCount.vue 0% 0% 0% 0% 18-1
beam/src/components/ListAnchor.vue 0% 100% 100% 0% 1
beam/src/components/ListItem.vue 0% 0% 0% 0% 37-14
beam/src/components/ListView.vue 0% 0% 0% 0% 36-null
beam/src/components/Navbar.vue 0% 0% 0% 0% 13-null
beam/src/components/ScanInput.vue 88.88% 100% 50% 87.5% 23
beam/src/components/SplitColumn.vue 0% 0% 100% 0% 5-8
beam/src/composables/mqtt.ts 0% 0% 0% 0% 8-40
Generated in workflow #416 for commit 248937c by the Vitest Coverage Report Action

@Alchez Alchez linked an issue Oct 29, 2024 that may be closed by this pull request
Comment on lines 109 to 124
const toast = useToast()
const toastType = ref('default')
const toastTime = ref(3)
const toastMsg = ref('Toast Message.')
const toastPosition = ref('top')

const showNotification = () => {
let toastOptions = {
message: toastMsg.value,
position: toastPosition.value,
duration: toastTime.value * 1000,
type: toastType.value,
}
// let notification = toast.success("Notified!", toastOptions)
let notification = toast.open(toastOptions)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crabinak @agritheory Should we create a wrapper around vue-toast-notification so that users can import it from @stonecrop/beam rather than having to remember to use the third-party library? Maybe we package the custom styles into our composable too?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Alchez @crabinak I agree. Curt is working on the style overrides but I don't think they're included here. There's a likely case where we want to use a toast notification in a desktop/aform type environment too,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agritheory @crabinak

Okay, so I tried to create a composable wrapper around the dependency but there seems to be an issue with it that I can't locate the source of.

  • If I keep the dependency in examples, then I get errors during the build but toasts still work inside the story so the errors are non-blocking.
    • Someone already raised an issue last month for the errors I saw but the author isn't interested in maintaining the project anymore.
  • If I move the dependency to beam and try to create a re-usable composable, then the build fails entirely and I'm unable to access any of the Beam stories. I'm not sure what's going on there but this is blocking.

I think we'll have to either:

  • look at another dependency
  • somehow fix the existing dependency
  • or recommend using the library manually in the target app (which kinda defeats the purpose of this PR)

What do you guys think?

@Alchez Alchez changed the title Feat beam toast notify feat: beam toast notify Nov 6, 2024
@Alchez Alchez changed the title feat: beam toast notify [beam] add toast notification component Nov 6, 2024
@agritheory agritheory merged commit c5ea189 into development Nov 7, 2024
6 of 7 checks passed
@Alchez Alchez deleted the feat-beam-toast-notify branch November 19, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[beam] Toast component
3 participants